﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Package;
using Microsoft.VisualStudio.TextManager.Interop;

namespace BlunderBrain.VisualStudio.AviSynth
{
    public class AviSynthMethods : Methods
    {
        private List<AviSynthFunction> m_methods;

        public AviSynthMethods()
        {
            m_methods = new List<AviSynthFunction>();
        }


        public void AddMethod(AviSynthFunction method)
        {
            m_methods.Add(method);
        }
        
        public override int GetCount()
        {
            return m_methods.Count;
        }

        public override string GetDescription(int index)
        {
            return string.Empty;
        }

        public override string GetName(int index)
        {
            return m_methods[index].Name;
        }

        public override int GetParameterCount(int index)
        {
            return m_methods[index].Parameters.Length;
        }

        public override void GetParameterInfo(int index, int parameter, out string name, out string display, out string description)
        {
            AviSynthFunctionParameter param = m_methods[index].Parameters[parameter];

            name = string.IsNullOrEmpty(param.Name) ? param.DataType.ToString() : param.Name;
            display = string.IsNullOrEmpty(param.Name) ? name : string.Format("{0}={1}", param.Name, param.DataType.ToString());
            description = string.Empty;
        }

        public override string GetType(int index)
        {
            return string.Empty;
        }
    }
}
